const mongoose = require("mongoose")
DB_URL = 'mongodb://localhost:27017/nw20001'
mongoose.Promise = global.Promise

//连接
mongoose.connect(DB_URL)

//连接完成
mongoose.connection.on("connected", function() {
	console.log("连接成功")
})

//错误
mongoose.connection.on("error", function() {
	console.log("连接失败")
})


// 导出
module.exports = mongoose
